import { Controller, Get } from '@nestjs/common';
import { Crud } from 'nestjs-mongoose-crud';
import { Personage } from '@libs/db/models/personage.model';
import { InjectModel } from 'nestjs-typegoose';
import { ApiTags } from '@nestjs/swagger';


@Crud({
    model: Personage,
    routes: {
       create: false,
       update: false,
       delete: false 
    }
})
@Controller('personages')
@ApiTags('人物')
export class PersonagesController {
    constructor(@InjectModel(Personage) private readonly model){}

    @Get('works')
    async getPersonagesWorks(){
        return await this.model.find().populate('works')
    }
}
